package com.it.product.service.impl;

import com.spzx.product.api.domain.Brand;
import com.it.product.mapper.BrandMapper;
import com.it.product.service.IBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * projectName: spzx-parent
 *
 * @author: 王宝贵
 * time: 2024/9/19 18:50 周四
 * description:
 */
@Service
public class BrandServiceImpl implements IBrandService {

    @Autowired
    BrandMapper brandMapper;

    /**
     * 查询品牌
     * @param brand 根据姓名查询
     * @return
     */
    @Override
    public List<Brand> list(Brand brand) {

        return brandMapper.list(brand);
    }

    /**
     * 查询品牌
     * @param id  主键id
     * @return
     */
    @Override
    public Brand selectById(Long id) {

        return brandMapper.selectById(id);
    }

    /**
     * 新增品牌
     * @param brand 品牌信息
     * @return
     */
    @Override
    public long save(Brand brand) {
        return brandMapper.insertList(brand);
    }

    /**
     * 修改品牌
     * @param brand 品牌信息
     * @return
     */
    @Override
    public Long updateBrand(Brand brand) {
        return brandMapper.updateBrand(brand);
    }

    /**
     * 删除品牌
     * @param ids 主键id们
     * @return
     */
    @Override
    public Long deleteBrandByIds(Long[] ids) {
        return brandMapper.delectBrandByIds(ids);
    }
}